package com.javabase.study.OOPFistPart;

/**
 * TODO
 * 内容：
 * 作者:jxx
 * 创建时间：2021/6/15
 */
public class TestExtends {
    public static void main(String[] args){
        Student s = new Student("jiangxx",172,"java");
        s.rest();
        s.study();
    }

}
class Person {
    String name;
    int height;
    public void rest(){
        System.out.println("休息一会！");
    }
}
class Student extends Person{
    String major;//专业

    public void study(){
        System.out.println("在家学习Java");
    }
    //天然拥有父类的属性
    public Student(String name,int height,String major){
        this.name = name;
        this.height = height;
        this.major = major;
    }
}
